inspector: Improve css node UI
authorMatthias Clasen <mclasen@redhat.com>
Sun, 25 Oct 2015 13:20:43 +0000 (09:20 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 25 Oct 2015 13:20:43 +0000 (09:20 -0400)
All the other object pages have a title, this one was missing it.
Add one, so the page fits in with the rest.

gtk/inspector/css-node-tree.c
gtk/inspector/css-node-tree.ui

index 48b5b75d50c8f8116b2b1f4543b15b85f0229fd1..6a2e1a9221d9e7a8432055786fb8ddf4c2a742a9 100644 (file)
@@ -26,7 +26,8 @@
 #include "css-node-tree.h"
 
 #include "gtktreemodelcssnode.h"
-#include <gtk/gtktreeview.h>
+#include "gtk/gtktreeview.h"
+#include "gtk/gtklabel.h"
 #include "gtk/gtkwidgetprivate.h"
 
 enum {
@@ -43,6 +44,7 @@ struct _GtkInspectorCssNodeTreePrivate
 {
   GtkWidget *tree_view;
   GtkTreeModel *model;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorCssNodeTree, gtk_inspector_css_node_tree, GTK_TYPE_BOX)
@@ -65,6 +67,7 @@ gtk_inspector_css_node_tree_class_init (GtkInspectorCssNodeTreeClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/css-node-tree.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, tree_view);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssNodeTree, object_title);
 }
 
 static int
@@ -154,11 +157,15 @@ gtk_inspector_css_node_tree_set_object (GtkInspectorCssNodeTree *cnt,
                                         GObject                 *object)
 {
   GtkInspectorCssNodeTreePrivate *priv;
-  
+  const gchar *title;
+
   g_return_if_fail (GTK_INSPECTOR_IS_CSS_NODE_TREE (cnt));
 
   priv = cnt->priv;
 
+  title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+  gtk_label_set_label (GTK_LABEL (priv->object_title), title);
+
   if (!GTK_IS_WIDGET (object))
     {
       gtk_tree_model_css_node_set_root_node (GTK_TREE_MODEL_CSS_NODE (priv->model), NULL);
index d9903ace548ff093e660aaa5c3234dbd1d35f873..d82ba15d2885f2dba475abeddac494a74ec239f3 100644 (file)
@@ -2,6 +2,15 @@
 <interface domain="gtk30">
   <template class="GtkInspectorCssNodeTree" parent="GtkBox">
     <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkLabel" id="object_title">
+        <property name="visible">True</property>
+        <property name="halign">fill</property>
+        <property name="valign">center</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+      </object>
+    </child>
     <child>
       <object class="GtkScrolledWindow">
         <property name="visible">True</property>
@@ -11,6 +20,7 @@
         <child>
           <object class="GtkTreeView" id="tree_view">
             <property name="visible">True</property>
+            <property name="enable-search">False</property>
             <child>
               <object class="GtkTreeViewColumn">
                 <property name="resizable">True</property>